﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NapazEngine.Utilities.Data
{
    class CodeHolder
    {
        /*
float horScaling = (float)GraphicsDevice.PresentationParameters.BackBufferWidth / Settings.DEFAULT_WINDOW_WIDTH;
float verScaling = (float)GraphicsDevice.PresentationParameters.BackBufferHeight / Settings.DEFAULT_WINDOW_HEIGHT;
Vector3 screenScalingFactor;
if (resultionIndependent)
{
float horScaling = (float)device.PresentationParameters.BackBufferWidth / baseScreenSize.X;
float verScaling = (float)device.PresentationParameters.BackBufferHeight / baseScreenSize.Y;
screenScalingFactor = new Vector3(horScaling, verScaling, 1);
}
else
{
screenScalingFactor = new Vector3(1, 1, 1);
}

         * In case resultionIndependent is true, we need to find the scaling factors. The horizontal scaling factor is found by dividing the real width of the user’s window, divided by the native resolution of our game. Check this for yourself: if the current resolution is the same as the native resolution, the factor will be 1. If the current resolution is larger, the factor will be larger, meaning that our scene should be stretched. If the curretn resolution is smaller, the factor will be smaller, so our scene will be shrinked.
In case resultionIndependent is false, the scene should be rendered to the scene just as it is, so the scaling factor should be 1, both horizontally as vertically.
Next, we need a way to scale our entire scene. We could adjust the scaling factors and positions of all of our spriteBatch.Draw calls, but there’s a much easier way: the spriteBatch.Begin method allows us to set a global transformation. This global transformation we’re going to set is a scaling, but you can also use it to easily rotate your entire scene, for example when porting your game to the Zune.
This global transformation will be described, as for any transformation, by a matrix. Add this line to our Draw method:
Matrix globalTransformation = Matrix.CreateScale(screenScalingFactor);
To set this transformation in the spriteBatch.Draw method, we need to use its most complex overload, the one that accepts 4 arguments. Change the first call to spriteBatch.Begin to this one:
spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None, globalTransformation);
Which enables simple alpha blending as discussed earlier, and sets our scaling as global transformation matrix. For more information on the second and third argument, I would like to refer to the first Recipes of Chapter 3 in my book, as they’re too powerful to be discussed only very briefly.
The second time we start our spriteBatch, we want it to use additive alpha blending, so change it to this line:     
spriteBatch.Begin(SpriteBlendMode.Additive, SpriteSortMode.Deferred, SaveStateMode.None, globalTransformation);

        
         
         
         
private void SetGraphicsThreeFourths()
{
    //Finds our maximum supported display mode
    foreach (DisplayMode d in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
    {
        if (d.Width >= windowWidth && d.Height >= windowHeight)
        {
            windowHeight = d.Height;
            windowWidth = d.Width;
        }
    }

    // preferred starting aspect ratio is 
    // 3/4ths of the largest supported
    windowHeight = windowHeight * 3 / 4;
    windowWidth = windowWidth * 3 / 4;

    // Setup frame buffer.
    graphics.SynchronizeWithVerticalRetrace = true;
    graphics.PreferredBackBufferWidth = windowWidth;
    graphics.PreferredBackBufferHeight = windowHeight;
    graphics.PreferMultiSampling = false;
    graphics.ApplyChanges();
}
         
         
         * */
    }
}
